package  
{
	import flash.display.*;
	
	/**
	 * 三角形填充
	 * @author StefanieKaka
	 */
	public final class BitmapTrianglesUV1 extends Sprite 
	{
		/// 构造函数
		public function BitmapTrianglesUV1() 
		{
			var vertices : Vector.<Number> = new Vector.<Number>();
			//vertices.push(100, 100);
			//vertices.push(200, 100);
			//vertices.push(200, 200);
			//vertices.push(100, 200);
			vertices.push(150, 50);
			vertices.push(1000, 100);
			vertices.push(800, 600);
			vertices.push(100, 200);
			
			var uvtData : Vector.<Number> = new Vector.<Number>();
			uvtData.push(0, 0);
			uvtData.push(1, 0);
			uvtData.push(1, 1);
			uvtData.push(0, 1);
			
			var indices : Vector.<int> = new Vector.<int>();
			indices.push(0, 1, 2);
			indices.push(2, 3, 0);
			
			var bitmap : Bitmap = new ImageClass() as Bitmap;
			this.graphics.beginBitmapFill(bitmap.bitmapData);
			this.graphics.drawTriangles(vertices, indices, uvtData);
			this.graphics.endFill();
		}
		
		[Embed(source="../lib/image.jpg")]
		private var ImageClass : Class;
		
	}

}